<?php defined('SYSPATH') or die('No direct script access.');

$colors = array(
    'btn-default'   => 'белый',
    'btn-primary'   => 'синий',
    'btn-info'      => 'голубой',
    'btn-success'   => 'зеленый',
    'btn-warning'   => 'оранжевый',
    'btn-danger'    => 'красный',

);
foreach($status as &$row)
{
    $select[$row['statusid']] = $row['statustext'];
}
?>

<div class="row">
    <div class="col-lg-6 col-md-6"><h4>Статусы Call</h4></div>
    <div class="col-lg-6 col-md-6"><h4>Статусы Reception</h4></div>
</div>
<div class="row">
<?php echo Form::open($controller.'/'.$action, array('id'=>'status_form','class'=>'form-inline','role'=>'form')) ?>
    <ul id="sortable1" class="connectedSortable col-lg-6">
<?php
foreach($status as &$row)
{
    if ($row['type']==1)
    {
?>
        <li class="ui-state-default">
            <div class="row">
                <div class="col-lg-1">
                    <span class="glyphicon glyphicon-move"></span>
                </div>
                <div class="col-lg-7">
                    <?php echo Form::input('status[]', $row['statustext'], array('class'=>'form-control','placeholder'=>'статус')) ?>
                </div>
                <div class="col-lg-4">
                    <?php echo Form::select('color[]', $colors, $row['color'], array('class'=>'form-control')) ?>
                </div>
            </div>
        </li>
<?php
    }
}
?>
    </ul>

    <ul id="sortable2" class="connectedSortable col-lg-6">
<?php
foreach($status as &$row)
{
    if ($row['type']==2)
    {
        ?>
        <li class="ui-state-default">
            <div class="row">
                <div class="col-lg-1">
                    <span class="glyphicon glyphicon-move"></span>
                </div>
                <div class="col-lg-7">
                    <?php echo Form::input('status[]', $row['statustext'], array('class'=>'form-control','placeholder'=>'статус')) ?>
                </div>
                <div class="col-lg-4">
                    <?php echo Form::select('color[]', $colors, $row['color'], array('class'=>'form-control')) ?>
                </div>
            </div>
        </li>
    <?php
    }
}
?>
    </ul>
    <ul id="sortable3" class="connectedSortable col-lg-6">

    </ul>

    <div class="row">
        <div class="col-lg-offset-4 col-lg-4">
            <button id="status_add" type="button" class="btn btn-default btn-block">Добавить статус</button>
            <button id="status_submit" type="button" class="btn btn-primary btn-block">Сохранить изменения</button>
        </div>

    </div>
</form>

</div>

<div id="status_line" class="row hidden">
    <div class="col-lg-1">
        <span class="glyphicon glyphicon-move"></span>
    </div>
    <div class="col-lg-7">
        <?php echo Form::input('status[]', '', array('class'=>'form-control','placeholder'=>'статус')) ?>
    </div>
    <div class="col-lg-4">
        <?php echo Form::select('color[]', $colors, '', array('class'=>'form-control')) ?>
    </div>
</div>
